package com.nulldev.util.geolocation.ipr;

import java.net.InetAddress;

import com.nulldev.util.date.ExtendedTime;
import com.nulldev.util.geolocation.ipr.GeoDBHandler.GeoDBEntry;
import com.nulldev.util.net.IPUtil;

public class GeoDBDemo {

	public static void main(String[] args) throws Exception {
		System.out.println("Current Time: " + ExtendedTime.get());
		final InetAddress gip = IPUtil.getPublicIPAsInet();
		for (int i = 0; i < GeoDBHandler.entries(); i++) {
			final GeoDBEntry gdbe = GeoDBHandler.read(i);
			if (gdbe.isInRange(gip)) {
				System.out.println(gdbe);
				break;
			}
		}
	}
}
